/*************************************************************************
 * File Name:    A.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Sun 13 Oct 2013 10:19:47 PM CST
 * 
 * Description:  http://codeforces.com/contest/283/problem/A
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <iomanip>

using namespace std;

int
main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    int n, a, x, k, t;
    double sum;
    vector<int> val;

    while (scanf("%d", &n) != EOF) {
    //while (cin >> n) {
        val.clear();
        val.push_back(0);
        sum = 0.0;

        for (int i = 0; i < n; ++i) {
            scanf("%d", &t);
            //cin >> t;
            switch(t) {
            case 1:
                scanf("%d %d", &a, &x);
                //cin >> a >> x;
                val[a - 1] += x;
                sum += a * x;
                break;
            case 2:
                scanf("%d", &k);
                //cin >> k;
                val[val.size() - 1] -= k;
                val.push_back(k);
                sum += k;
                break;
            case 3:
                val[val.size() - 2] += val[val.size() - 1];
                sum -= val[val.size() - 1];
                val.pop_back();
                break;
            }
            printf("%.10lf\n", sum / val.size());
            //cout << setprecision(10) << sum / val.size() << endl;
        }
    }
    return 0;
}
